const mysql = require('mysql')

module.exports = {
    config: {
        host: '175.24.121.204',
        port: '3306',
        user: 'zhangyang_blog',
        password: 'root',
        database: 'zhangyang_blog'
    },
    // 数据库连接池
    sqlConnect: function (sql, sqlArr, callback) {
        var pool = mysql.createPool(this.config)
        pool.getConnection((err, conn) => {
            if (err) {
                console.log('连接失败')
                return;
            }
            conn.query(sql, sqlArr, callback);
            conn.release()
        })
    }
}